loadingMsg({
    wrap: "infowListWrap",
    message: "加载中"
})
$.ajax({
    url: "./data/index.php",    //请求的url地址
    dataType: "json",   //返回格式为json
    async: false, //请求是否异步，默认为异步，这也是ajax重要特性
    withCredentials:true,
    cache: false, // 是否读取缓存
    data: {
        // module: 'welfare',
        categoryId: 123456
        // 'category': 123456
    },    //参数值
    type: "POST",   //GET\POST
    beforeSend: function() {},
    success: function(req) {//请求成功时处理
        console.log(1111)
        let infoListWrap = document.getElementById('infowListWrap');
        console.log(infoListWrap)
        //判断数据是否存在
        if(!req.data || req.data.length ===0){
            // infoListWrap.innerHTML = `<div class="loading-wait">当前没有数据</div>`;
            loadingMsg({
                wrap: "infowListWrap",
                message: "当前数据为空"
            })
            return false
        }
        // <a herf="newaDetail.php?id=$(item.id)">
        let ul = `<ul class="clearfix">`
        req.data.forEach(item => {
            //console.log(item,"itemajax")
            ul += `
            <figure>
                <a herf="newDetail.php?id=${item.id}">
                <img src="${item.imgUrl}" alt="${item.title}">
                <figcaption>${item.title}</figcaption>
                <p>${item.dec}</p>
                </a>
            </figure>`
        })
        ul += `</ul>`
        infoListWrap.innerHTML = ul
    },
    // compete: function(){},
    // error: function(){
    //     //请求出错处理
    // }
});

$.ajax({
    url: "./data/index.php",    //请求的url地址
    dataType: "json",   //返回格式为json
    async: false, //请求是否异步，默认为异步，这也是ajax重要特性
    cache: false, // 是否读取缓存
    data: {
        module: 'welfare',
        categoryId: 10000
    },    //参数值
    type: "POST",   //GET\POST
    beforeSend: function() {},
    success: function(req) {//请求成功时处理
        let data = req.data
        let html = ''
        let welfareWrap = document.getElementById('welfareWrap');
        // 处理第一个
        html += `<div class="row">
            <div class="content-flex">
                <div class="content-flex-big img-cover">
                    <img src="${data[0].imgUrl}" alt="${data[0].title}">
                </div>
                <div class="content-flex-small" style="background-color: #${data[0].bgColor};">
                    <div class="content-dec">
                        <h4 class="title">${data[0].title}</h4>
                        <time datatime="${data[0].date}" pubdate="${data[0].date}">${data[0].date}</time>
                        <i class="line"></i>
                        <a href="" class="link-more">
                            查看更多
                            <i class="iconfont icon-jiantou_xiangyou_o"></i>
                        </a>
                    </div>
                </div>
            </div>
        </div>`
        
        
        req.data.forEach((item, index) => {
            if(index != 0) {
                html += `
                <div class="row">
                    <div class="content-flex">
                        <div class="content-flex-big ${item.color}" style="background-color: #${item.bgColor};">
                            <div class="content-dec">
                                <h4 class="title">${item.title}</h4>
                                <time datatime="${item.date}" pubdate="${item.date}">${item.date}</time>
                                <i class="line"></i>
                                <p class="dec">${item.dec}</p>
                                <a href="" class="link-more">
                                    查看更多
                                    <i class="iconfont icon-jiantou_xiangyou_o"></i>
                                </a>
                            </div>
                        </div>
                        <div class="content-flex-small img-cover">
                            <img src="${item.imgUrl}" alt="${item.title}">
                        </div>
                    </div>
                </div>`
            }
        })
        welfareWrap.innerHTML = html
        
    },
    complete: function() {},
    error: function() {
        //请求出错处理
    }
});